package brokerFailureSuperController;

import java.util.HashMap;

import brokerFailureDetector.Detector;

/**
 * Creates a detector.
 */
public class DetectorCreatorThread extends Thread {
	
	//IP address of the detector
	String hostIP;
	//IP address of the broker controller
	String controllerIP;
	//list of the IP addresses of the brokers in the system mapped to the ports
	//in which they are listening
	HashMap<String, Integer> brokerAddresses;
	
	/**
	 * Constructor.
	 * 
	 * @param hostIP  IP address of the detector
	 * @param controllerIP  IP address of the broker controller
	 * @param brokerAddresses  list of the IP addresses of the brokers in the
	 * 						   system mapped to the ports in which they are
	 * 						   listening
	 */
	public DetectorCreatorThread(String hostIP, String controllerIP,
			 					 HashMap<String, Integer> brokerAddresses) {
		
		this.hostIP = hostIP;
		this.controllerIP = controllerIP;
		this.brokerAddresses = brokerAddresses;
    	
    	start();
    	
    }
	
	/**
	 * Create a detector.
	 */
	public void run() {
		new Detector(hostIP, controllerIP, brokerAddresses);
	}

}
